package com.cxg.allsys.adminsys.test;
import com.cxg.allsys.adminsys.StartApp;
import com.cxg.allsys.adminsys.mapper.ExpertMapper;
import com.cxg.allsys.adminsys.pojo.Expert;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import java.sql.Timestamp;


@RunWith(SpringRunner.class)
@SpringBootTest
@ContextConfiguration(classes = StartApp.class)
@Slf4j
public class SpringBootTestDemo {
    @Autowired
    private ExpertMapper expertMapper ;
    @Test
    public void testInsert(){
        log.info("testInsert方法测试！");
        Expert expert = new Expert();
        expert.setHeadImg("TestImage1");
        expert.setExpertName("TestName1");
        expert.setSex("TestSes1");
        expert.setPhone("TestPhone1");
        expert.setPassword("TestPassword1");
        expert.setStatus("0");
//        String dateString = ZhuanHuanTools.timeStamp2Date(sec, "yyyy-MM-dd HH:mm:ss");
//        SimpleDateFormat sdf =   new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
//        Date dateTemp=null;
//        try {
//            dateTemp = sdf.parse(dateString);
//        } catch (ParseException e) {
//            e.printStackTrace();
//        }
//        //java.util.Date转java.sql.Timestamp
//        Timestamp timeStamp1 = new Timestamp(dateTemp.getTime());
        String str = "2015-02-25 11:11:11";
        Timestamp t = Timestamp.valueOf(str);
        expert.setCreateDate(null);
        expert.setLastTime(null);
        expert.setCompany("TestCompany");
        expert.setSpecialty("TestSpecialty1");
        expert.setNumberCard("TestNumberCard:000000001");
        expertMapper.insert(expert);

    }
}
